﻿using AnesSystem.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem.ViewModels.Pacu.CQ.CQTL
{
   public class PacuRecordCtrlViewModel :ViewModels.PacuRecordCtrlViewModel
    {
        #region Variables

        #endregion


        #region Constructor
        public PacuRecordCtrlViewModel()
        {

        }
        #endregion


        #region Properties

        #endregion


        #region 依赖属性


        #endregion


        #region Event


        #endregion


        #region PrivateMethods


        #endregion


        #region Public/ProtectedMethods

        public override void InitData()
        {
            if (!DataManager.Instance.PatientLinkCache.ContainsKey(CurPatientLink.Id))
            {
                PacuRecordItems.Clear();
                PacuRecordCtrlViewModels.Clear();
                for (int page = 1; page <= CurTotalPage; page++)
                {
                    PacuRecordItemCtrlViewModel viewModel = new PacuRecordItemCtrlViewModel(page);
                    PacuRecordItems.Add(viewModel);
                    PacuRecordCtrlViewModels.Add(page, viewModel);
                }
                LoadData();
            }
            else
            {
                BaseTableControl ctrl = DataManager.Instance.PacuRecordCtrl;
                if (ctrl.IsNewCreate)
                {
                    PacuRecordItems.Clear();
                    PacuRecordCtrlViewModels.Clear();
                    for (int page = 1; page <= CurTotalPage; page++)
                    {
                        PacuRecordItemCtrlViewModel viewModel = new PacuRecordItemCtrlViewModel(page);
                        PacuRecordItems.Add(viewModel);
                        PacuRecordCtrlViewModels.Add(page, viewModel);
                    }
                    ctrl.IsNewCreate = false;
                    LoadData();
                }
            }
        }

        #endregion


        #region EventHandlers


        #endregion
    }
}

